
//% color="#9F32F1" iconWidth=50 iconHeight=40
namespace URM09_Trig{
    //% block="读取超声波传感器距离Trig&Echo引脚为[PIN]单位厘米" blockType="reporter"
    //% PIN.shadow="dropdown" PIN.options="PIN"
    export function udp_server(parameter: any, block: any) {
        let pin1 = parameter.PIN.code;
        Generator.addImport("from mpython import *\nfrom URM09_Trig import URM09_Trig");  
        Generator.addDeclaration("URM09_Trig",`sonar1 = URM09_Trig((Pin.${pin1}))`);  
        Generator.addCode("sonar1.distance_cm()")

    }



}
